package com.hex.ds.hdtp.core.inf.data.contrast.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hex.ds.hdtp.core.inf.data.contrast.mapper.ICrossDbContrastResultMapper;
import com.hex.ds.hdtp.core.inf.data.contrast.po.CrossDbContrastResultPo;
import com.hex.ds.hdtp.core.inf.data.contrast.repository.ICrossDbContrastResultRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Package: com.hex.ds.hdtp.core.inf.data.contrast.repository.impl
 * @ClassName CrossDbContrastResultRepository
 * @Description: 跨库比对清单对比结果-数据接口实现类
 * @Author: wz.li
 * @Date 2023/7/25 18:52
 * @Version v2.0.2
 **/
@Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CrossDbContrastResultRepository implements ICrossDbContrastResultRepository {

    private final ICrossDbContrastResultMapper crossDbContrastResultMapper;

    /*
     * @Method: add <br>
     * @Param: [crossDbContrastResultPo] <br>
     * @Return: java.lang.Integer <br>
     * @Description：新增<br>
     * @Author： wz.li<br>
     * @Date： 2023/7/25 18:53 <br>
     * @Version： V2.0.2<br>
     */
    @Override
    public Integer add(CrossDbContrastResultPo crossDbContrastResultPo) {
        return crossDbContrastResultMapper.insert(crossDbContrastResultPo);
    }

    /*
     * @Method: queryList <br>
     * @Param: [contrastListPkId, contrastVersion] <br>
     * @Return: java.util.List<com.hex.ds.hdtp.core.inf.data.contrast.po.CrossDbContrastResultPo> <br>
     * @Description：根据转换清单主键和版本查询<br>
     * @Author： wz.li<br>
     * @Date： 2023/7/25 19:33 <br>
     * @Version： V2.0.2<br>
     */
    @Override
    public List<CrossDbContrastResultPo> queryList(String contrastListPkId, String contrastRunLogPkId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("contrast_list_pk_id", contrastListPkId);
        queryWrapper.eq("contrast_run_Log_pk_id", contrastRunLogPkId);
        return crossDbContrastResultMapper.selectList(queryWrapper);
    }
}
